# 导入模块
from selenium.webdriver.common.by import By
from selenium import webdriver
import time
import os


# 初始化数据
class Upload:
    def __init__(self):
        self.driver = webdriver.Chrome()
        url = 'file:///' + os.path.abspath('html') + '/upload_file.html'
        self.driver.get(url)

    def upload(self):
        # 准备上传文件的绝对路径
        url1 = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/geckodriver.log'

        # 定位上传标签，输入上传文件
        self.driver.find_element(By.NAME, 'file').send_keys(url1)

    def quit(self):
        # 退出浏览器
        self.driver.quit()


if __name__ == '__main__':
    pass
